package com.cool.modules.finance.constant;

import com.mybatisflex.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum OrderType {

    EXPEND("支出",1),
    INCOME("收入",2);

    private String name;

    @EnumValue
    private Integer value;

    OrderType(String name,Integer value){
        this.name = name;
        this.value = value;
    }

    public static OrderType getByValue(Integer value){
        for (OrderType orderType : OrderType.values()) {
            if(orderType.getValue().equals(value)){
                return orderType;
            }
        }
        return null;
    }
}
